#include <iostream>
#include <sstream>
#include <string>


using namespace std;


void stringStreamFormat();

void StringStreamTest()
{
	stringStreamFormat();

	string line, word;
	while(getline(cin, line))
	{
		istringstream stream (line);
		while(stream >> word)
		{
			cout << word << endl;
		}		
	}
}

void stringStreamFormat()
{
	int iv1 = 512, iv2 = 1024;

	ostringstream format_msg;
	// converts values to a string representation
	format_msg << "iv1: " << iv1 << "\n"
			   << "iv2: " << iv2 << "\n";

	// str member obtains the string associated with a stringstream
	istringstream input_istring(format_msg.str());
	string dump;
	// extracts the stored ascii values, converting back to arithmetic types
	input_istring >> dump >> iv2 >> dump >> iv1;
	cout << iv1 << " " << iv2 << endl;
}